home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / boot / czesc_2 / smsrc / sm / stopclick.pas < prev    next >
Pascal/Delphi Source File  |  1995-07-11  |  823b  |  40 lines

  1. { stop the annoying drive clicks }
  2. Procedure ToggleClick;
  3.  
  4. VAR
  5.     td   : pIOExtTD;
  6.     po   : pMsgPort;
  7.     tpu  : pTDU_PublicUnit;
  8.     uni  : byte;
  9.  
  10. Begin    
  11.     if NOT state Then
  12.         Exit;
  13.     { create a port }
  14.     po := CreateMsgPort;
  15.     if po <> NIL then Begin
  16.         { for each drive 0-3 }
  17.         for uni := 0 to 4 do begin
  18.             { create an IORequest }
  19.             td := pIOExtTD(CreateIORequest(po, sizeof(tIOExtTD)));
  20.             if td <> NIL then begin
  21.                 { IOrequest valid }
  22.                 if OpenDevice('trackdisk.device', uni, pIORequest(td), 0) = 0 then begin
  23.                     { valid unit, so tell it to shut up }
  24.                     tpu := pTDU_PublicUnit(td^.iotd_Req.io_Unit);
  25.                     { Stop Clicking NOW ! }
  26.                     tpu^.tdu_PubFlags := tpu^.tdu_PubFlags | TDPF_NOCLICK;
  27.                     CloseDevice(pIORequest(td));
  28.                 end;
  29.                 DeleteIORequest(pIORequest(td));
  30.             end;
  31.         end;
  32.         DeleteMsgPort(po);
  33.    end;
  34. end;
  35.  
  36.  
  37.  
  38.  
  39.  
  40.